#include<stdio.h>
int main(){
	int n,b;
	int x=1;
	int y=0;
	char a[1005];
	scanf("%d",&n);
	scanf("%s",a);
	while(x<n){
	y=0;
	while(y<=x){
		if(a[y]!=a[n-1-x+y]){
		b=0;
		x++;
		break;
		}else{b=1;}
		y++;}
		if(b==1){
		printf("%d",y);
		break;
		}
	}
	
	return 0;
}
